import wepy from  'wepy';
import base from './base';

export default class Home extends base {
  //获取验证码
  static async getMsg({telphone,code}){
    let url = `${this.baserUrl}/api/passport/sms_send`;
    return this.post(url,{telphone,code});
  }
  // 用户登陆
  static login({encryptedData,verify,iv,telphone}) {
    const url = `${this.baserUrl}/api/passport/login`;
    return this.post(url,{encryptedData,verify,iv,telphone});
  }
  //创建收货地址
  static async createAddress({uname,telphone,province,city,address,defaults}){
    let url = `${this.baserUrl}/api/User/address_create`;
    return this.post(url,{uname,telphone,province,city,address,defaults});
  }
  //收货地址详情
  static async addressDetails({id}){
    let url = `${this.baserUrl}/api/User/address_details`;
    return this.post(url,{id});
  }
  //收货地址列表
  static async addressList({}){
    let url = `${this.baserUrl}/api/User/address_list`;
    return this.post(url,{});
  }
  //修改收货地址
  static async editAddress({uname,telphone,province,city,address,id,defaults}){
    let url = `${this.baserUrl}/api/User/address_edit`;
    return this.post(url,{uname,telphone,province,city,address,id,defaults});
  }
  //删除收货地址
  static async addressDelete({id}){
    let url = `${this.baserUrl}/api/user/address_delete`;
    return this.post(url,{id});
  }
  //首页热门稿件列表
  static async hotList({page,limit="5"}){
    let url = `${this.baserUrl}/api/Works/works_hot_list`;
    return this.post(url,{page,limit});
  }
  //首页附近稿件列表
  static async nearyList({page,limit="5",location}){
    let url = `${this.baserUrl}/api/Works/works_neary_list`;
    return this.post(url,{page,limit,location});
  }
  //稿件详情
  static async borwserDetails({workid}){
    let url = `${this.baserUrl}/api/works/works_details_act`;
    return this.post(url,{workid});
  }
  //首页搜索信息列表
  static async searchList({page,limit="5",userid,keywords}){
    let url = `${this.baserUrl}/api/Works/works_serach_list`;
    return this.post(url,{page,limit,userid,keywords});
  }
  //首页搜索信息记录
  static async searchRecord({userid}){
    let url = `${this.baserUrl}/api/Works/works_search_record`;
    return this.post(url,{userid});
  }
  //首页搜索信息删除
  static async searchRecordDel({userid}){
    let url = `${this.baserUrl}/api/Works/works_search_record_del`;
    return this.post(url,{userid});
  }
  //个人用户信息显示
  static async informationDetails({}){
    let url = `${this.baserUrl}/api/user/user_info`;
    return this.post(url,{});
  }
  //修改用户名
  static async usernameEdit({username}){
    let url = `${this.baserUrl}/api/user/username_edit`;
    return this.post(url,{username});
  }
  //修改性别
  static async sexEdit({sex}){
    let url = `${this.baserUrl}/api/user/sex_edit`;
    return this.post(url,{sex});
  }
  //修改生日
  static async birthdayEdit({birthday}){
    let url = `${this.baserUrl}/api/user/birthday_edit`;
    return this.post(url,{birthday});
  }
  //首页动态信息显示
  static async trendList({page,limit="5"}){
    let url = `${this.baserUrl}/api/Works/works_trend_list`;
    return this.post(url,{page,limit});
  }
  //稿件浏览足迹信息数据
  static async footmarkList({page,limit="5"}){
    let url = `${this.baserUrl}/api/Works/works_footmark_list`;
    return this.post(url,{page,limit});
  }
  //稿件浏览足迹信息清除
  static async footmarkClearn({clean}){
    let url = `${this.baserUrl}/api/Works/works_footmark_clean`;
    return this.post(url,{clean});
  }
  //问题》回答问题
  static async questionAnswer({worksid,question_id,answer}){
    let url = `${this.baserUrl}/api/question/question_answer`;
    return this.post(url,{worksid,question_id,answer});
  }
  //参与的稿件列表
  static async takeparList({page,limit="5"}){
    let url = `${this.baserUrl}/api/works/works_takepart_list`;
    return this.post(url,{page,limit});
  }
  //收藏稿件列表
  static async collectList({page,limit="5"}){
    let url = `${this.baserUrl}/api/works/works_collect_list`;
    return this.post(url,{page,limit});
  }
  //收藏稿件功能
  static async collectAct({worksid}){
    let url = `${this.baserUrl}/api/works/works_collect_act`;
    return this.post(url,{worksid});
  }
  //投票系统数据列表
  static async voteList({page,limit="5"}){
    let url = `${this.baserUrl}/api/vote/vote_data_list`;
    return this.post(url,{page,limit});
  }
  //投票系统数据详情
  static async voteDetails({voteid}){
    let url = `${this.baserUrl}/api/vote/vote_detail_act`;
    return this.post(url,{voteid});
  }
  //投票系统投票
  static async voteBallot({voteid,vitemid}){
    let url = `${this.baserUrl}/api/vote/vote_ballot_act`;
    return this.post(url,{voteid,vitemid});
  }
  //默认收货地址 >没有则返回null
  static async addressDefault({}){
    let url = `${this.baserUrl}/api/user/address_default`;
    return this.post(url,{});
  }
  //商品下单
  static async goodsBuy({code,number,goodsid,attrid,province,city,address,username,telphone,wid}){
    let url = `${this.baserUrl}/api/order/buy`;
    return this.post(url,{code,number,goodsid,attrid,province,city,address,username,telphone,wid});
  }
  //订单列表
  static async getOrderList({page,limit="5",type}){
    let url = `${this.baserUrl}/api/order/order_list_act`;
    return this.post(url,{page,limit,type});
  }
  //订单详情
  static async orderDetails({id}){
    let url = `${this.baserUrl}/api/order/order_details_act`;
    return this.post(url,{id});
  }
  //产品页》领取优惠券
  static async receiveAct({goodsid}){
    let url = `${this.baserUrl}/api/coupon/coupon_receive_act`;
    return this.post(url,{goodsid});
  }
  //优惠券列表
  static async couponList({}){
    let url = `${this.baserUrl}/api/coupon/coupon_list_act`;
    return this.post(url,{});
  }
  //优惠券详情
  static async couponDetails({id}){
    let url = `${this.baserUrl}/api/coupon/coupon_details_act`;
    return this.post(url,{id});
  }
  //分享优惠券领取
  static async couponShareget({couponsn}){
    let url = `${this.baserUrl}/api/coupon/coupon_shareget_act`;
    return this.post(url,{couponsn});
  }
  //确认收货
  static async order_confirm({id}){
    let url = `${this.baserUrl}/api/order/order_confirm`;
    return this.post(url,{id});
  }
}
